<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:m="http://www.ol4jsf.org"
	xmlns:o="http://openfaces.org/"
	xmlns:a4j="http://richfaces.org/a4j">

	<style>
		.noMaskClass .rich-mpnl-mask-div {
			display:none;
		}
		.contentEditData {
			width:100%;
			height:290px;
			overflow:auto;
		}
	</style>
	
	<rich:modalPanel id="editDataPanelToolbox" width="500" height="480" styleClass="noMaskClass" zindex="10000">
		<f:facet name="header">
			<h:outputText value="#{messages['dataentry.editdata_toolbox_desc']}"/>
		</f:facet>
		
		<f:facet name="controls">
			<h:panelGroup>
				<h:graphicImage value="/img/close.png" styleClass="hidelink"
					id="hideEditDataPanel" />
				<rich:componentControl for="editDataPanelToolbox" attachTo="hideEditDataPanel"
					operation="hide" event="onclick" />
			</h:panelGroup>
		</f:facet>
		
		<h:panelGroup id="panelData">
			<ui:include src="./includes/selectedZoneTlb.xhtml" />
			<br />
			<h:messages />
			<h:panelGroup rendered="#{interactiveViewerHelper.selectedZone == null}">
				<div align="center">
					<h:outputText value="#{messages['txt.no_zone_or_parcel_selected']}" />
				</div>
			</h:panelGroup>
			<h:panelGroup rendered="#{interactiveViewerHelper.selectedZone != null}">
				<h:form id="frmEditData">
					<rich:tabPanel id="editDataTabPanel" switchType="client" selectedTab="firstTab">
						<rich:tab name="firstTab" label="#{messages['dataentry.editdata.cadastral_section']}">
							<div class="contentEditData">
								<rich:tabPanel switchType="client">
									<rich:tab label="Generales">
										<div align="center">
											<strong>
												Datos de la Zona
											</strong>
											<rich:separator lineType="solid"/>
											<br />
											<h:panelGroup id="editDataCadastre1Tab">
												<h:panelGrid columns="2">
													<h:outputLabel value="#{messages['dataentry.editdata.parcel_name']}" for="zoneName"/>
													<h:inputText id="zoneName" label="#{messages['dataentry.editdata.parcel_name']}" value="#{interactiveViewerHelper.selectedZone.zoneName}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
						
													<h:outputLabel value="#{messages['dataentry.editdata.geometry_area']}" for="geometryArea"/>
													<h:inputText id="geometryArea" label="#{messages['dataentry.editdata.geometry_area']}" value="#{interactiveViewerHelper.selectedZone.geometryArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
												
													<h:outputLabel value="#{messages['dataentry.editdata.documented_area']}" for="documented_area"/>
													<h:inputText id="documented_area" label="#{messages['dataentry.editdata.documented_area']}" value="#{interactiveViewerHelper.selectedZone.documentedArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
												
													<h:outputLabel value="#{messages['dataentry.editdata.measured_area']}" for="measured_area" />
													<h:inputText id="measured_area" label="#{messages['dataentry.editdata.measured_area']}" value="#{interactiveViewerHelper.selectedZone.measuredArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
		
													<h:outputLabel value="#{messages['dataentry.editdata.location_in_country']}" for="location_in_country"/>
													<h:inputText id="location_in_country" label="#{messages['dataentry.editdata.location_in_country']}" value="#{interactiveViewerHelper.selectedZone.locationInCountry}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
												</h:panelGrid>
												<br />
												<h:panelGroup rendered="#{interactiveViewerHelper.parcelSelected}">
													<strong>
														Datos de Parcela
													</strong>
													<rich:separator lineType="solid"/>
													<br />
													<h:panelGrid columns="2">
														<h:outputLabel value="#{messages['dataentry.editdata.documented_built_area']}" for="documentedBuiltArea"/>
														<h:inputText id="documentedBuiltArea" label="#{messages['dataentry.editdata.documented_built_area']}" value="#{interactiveViewerHelper.selectedZone.documentedBuiltArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
													
														<h:outputLabel value="#{messages['dataentry.editdata.ground_built_area']}" for="ground_built_area"/>
														<h:inputText id="ground_built_area" label="#{messages['dataentry.editdata.ground_built_area']}" value="#{interactiveViewerHelper.selectedZone.groundBuiltArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
													
														<h:outputLabel value="#{messages['dataentry.editdata.neighborhood']}" for="neighborhood"/>
														<h:inputText id="neighborhood" label="#{messages['dataentry.editdata.neighborhood']}" value="#{interactiveViewerHelper.selectedZone.neighborhood}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
							
														<h:outputLabel value="#{messages['dataentry.editdata.access_way1']}" for="access_way1"/>
														<h:inputText id="access_way1" label="#{messages['dataentry.editdata.access_way1']}" value="#{interactiveViewerHelper.selectedZone.accessWay1}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
							
														<h:outputLabel value="#{messages['dataentry.editdata.access_way2']}" for="access_way2"/>
														<h:inputText id="access_way2" label="#{messages['dataentry.editdata.access_way2']}" value="#{interactiveViewerHelper.selectedZone.accessWay2}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
							
														<h:outputLabel value="#{messages['dataentry.editdata.house_number']}" for="house_number"/>
														<h:inputText id="house_number" label="#{messages['dataentry.editdata.house_number']}" value="#{interactiveViewerHelper.selectedZone.houseNumber}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
													</h:panelGrid>
												</h:panelGroup>
												<h:panelGroup rendered="#{interactiveViewerHelper.buildingSelected}">
													<strong>
														Datos de la Edificacion
													</strong>
													<rich:separator lineType="solid"/>
													<br />
													<h:panelGrid columns="2">
														<h:outputLabel value="Tipo de edificacion (LADM)" />
														<h:selectOneMenu value="#{interactiveViewerHelper.selectedZone.type}" converter="#{uiConverters.buildingUnitType}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}">
															<f:selectItems value="#{uiConverters.buildingUnitType.valueList}"/>
														</h:selectOneMenu>
														
														<h:outputLabel value="Numero de pisos" />
														<rich:inputNumberSpinner value="#{interactiveViewerHelper.selectedZone.numberOfFloors}" minValue="1" maxValue="100" required="true" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
														
														<h:outputLabel value="Area de construccion" />
														<h:inputText value="#{interactiveViewerHelper.selectedZone.builtArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
														
														<h:outputLabel value="Valor de la construccion" />
														<h:inputText value="#{interactiveViewerHelper.selectedZone.value}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
														
														<h:outputLabel value="Tipo de construccion" />
														<h:panelGroup>
															<h:inputText id="txtBuildingType"
																value="#{interactiveViewerHelper.selectedZone.buildingType != null ? interactiveViewerHelper.selectedZone.buildingType.name : ''}"
																required="true"
																style="width:70%"
																requiredMessage="Valor requerido"
																validatorMessage="Valor muy corto"
																readonly="true">
															</h:inputText>
															<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
																#{'   '}
																<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectBuildingTypePanel')}.show()">
																	<f:setPropertyActionListener target="#{buildingTypeHelper.returnValueField}" value="interactiveViewerHelper.selectedZone.buildingType" />
																	<f:setPropertyActionListener target="#{buildingTypeHelper.reRenderComponents}" value="txtBuildingType" />
																	<h:outputText value="#{messages['intro.search']}" />
																</a4j:commandLink>
																<br />
																<rich:message style="color:Red;" for="txtBuildingType" />
															</h:panelGroup>
														</h:panelGroup>
														
														<h:outputLabel value="Materiales de construccion" />
														<h:panelGroup>
															<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectBuildingMaterialPanel')}.show()">
																<f:setPropertyActionListener target="#{buildingMaterialHelper.addingToList}" value="#{true}" />
																<f:setPropertyActionListener target="#{buildingMaterialHelper.addToListMethod}" value="buildingPermitHelper.addBuildingMaterial" />
																<f:setPropertyActionListener target="#{buildingMaterialHelper.returnValueField}" value="buildingPermitHelper.selectedBuildingMaterial" />
																<f:setPropertyActionListener target="#{buildingMaterialHelper.reRenderComponents}" value="grpBuildingMaterials" />
																<h:outputText value="#{messages['intro.search']}" />
															</a4j:commandLink>
															<br />
															<br />
															<h:panelGroup id="grpBuildingMaterials">
																<h:panelGroup rendered="#{not empty interactiveViewerHelper.selectedZone.buildingMaterials}">
																	<rich:dataGrid var="material" value="#{interactiveViewerHelper.selectedZone.buildingMaterials}" columns="2">
																		<table style="width: 200px">
																			<tr>
																				<td style="width: 70%">
																					<h:outputText value="#{material.name}" />
																				</td>
																				<td>
																					<a4j:commandLink
																						ajaxSingle="true"
																						value="Eliminar"
																						action="#{buildingPermitHelper.deleteBuildingMaterial(material)}"
																						reRender="buildingMaterials">
																					</a4j:commandLink>
																				</td>
																			</tr>
																		</table>
																	</rich:dataGrid>
																</h:panelGroup>
																<h:panelGroup rendered="#{empty interactiveViewerHelper.selectedZone.buildingMaterials}">
																	Especifique uno o mas materiales de construccion
																</h:panelGroup>
															</h:panelGroup>
														</h:panelGroup>
													</h:panelGrid>
												</h:panelGroup>
											</h:panelGroup>
										</div>
									</rich:tab>
									<rich:tab label="Restricciones para Permisos" rendered="#{interactiveViewerHelper.parcelDataHelper.frontEndSchema}">
										<div align="center">
											<strong>
												<h:outputText value="Restricciones de zona" />
											</strong>
											<rich:separator lineType="solid"/>
											<br />
											<h:panelGroup id="cadastreNormPermitTab">
												<h:panelGrid columns="2">
													<h:outputLabel value="Numero maximo de pisos permitidos" for="maxNumberOfFloors"/>
													<h:inputText id="maxNumberOfFloors" label="Numero maximo de pisos permitidos" value="#{interactiveViewerHelper.selectedZone.permitNorm.maxNumberOfFloors}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
						
													<h:outputLabel value="Area maxima de construccion permitida" for="maxBuildingArea"/>
													<h:inputText id="maxBuildingArea" label="Area maxima de construccion permitida" value="#{interactiveViewerHelper.selectedZone.permitNorm.maxBuildingArea}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
												</h:panelGrid>
												<br />
												<br />
												<strong>
													<h:outputText value="Materiales de construccion no permitidos en esta zona" />
												</strong>
												<rich:separator lineType="solid"/>
												<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
													<br />
													<a4j:commandLink ajaxSingle="true" oncomplete="#{rich:component('selectBuildingMaterialPanel')}.show()">
														<f:setPropertyActionListener target="#{buildingMaterialHelper.addingToList}" value="#{true}" />
														<f:setPropertyActionListener target="#{buildingMaterialHelper.addToListMethod}" value="interactiveViewerHelper.parcelDataHelper.addForbiddenBuildingMaterial" />
														<f:setPropertyActionListener target="#{buildingMaterialHelper.returnValueField}" value="interactiveViewerHelper.parcelDataHelper.newForbiddenBuildingMaterial" />
														<f:setPropertyActionListener target="#{buildingMaterialHelper.reRenderComponents}" value="grpForbiddenBuildingMaterials" />
														<h:outputText value="Agregar" />
													</a4j:commandLink>
													<br />
												</h:panelGroup>
												<br />
												<h:panelGroup id="grpForbiddenBuildingMaterials">
													<rich:dataTable
														var="bm"
														rowKeyVar="row"
														rendered="#{not empty interactiveViewerHelper.selectedZone.permitNorm.forbiddenBuildingMaterials}"
														value="#{interactiveViewerHelper.selectedZone.permitNorm.forbiddenBuildingMaterials}">
														<rich:column label="No.">
															<h:outputText value="#{row + 1}" />
														</rich:column>
														<rich:column label="Nombre">
															<h:outputText value="#{bm.name}" />
														</rich:column>
														<rich:column rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
															<a4j:commandLink
															value="Eliminar"
															action="#{interactiveViewerHelper.parcelDataHelper.deleteForbiddenBuildingMaterial}"
															reRender="grpForbiddenBuildingMaterials">
																<f:setPropertyActionListener target="#{interactiveViewerHelper.parcelDataHelper.newForbiddenBuildingMaterial}" value="#{bm}" />
															</a4j:commandLink>
														</rich:column>
													</rich:dataTable>
													<h:outputText value="No hay elemento(s) disponible(s)" rendered="#{empty interactiveViewerHelper.selectedZone.permitNorm.forbiddenBuildingMaterials}" />
												</h:panelGroup>
											</h:panelGroup>
										</div>
									</rich:tab>
								</rich:tabPanel>
							</div>
						</rich:tab>
						<rich:tab label="#{messages['dataentry.editdata.cadastral_section2']}" rendered="#{interactiveViewerHelper.parcelSelected}">
							<div class="contentEditData">
								<rich:tabPanel id="editDataCadastre2Tab" switchType="client" selectedTab="tab1">
									<rich:tab name="tab1" label="#{messages['txt.available_services']}">
										<h:panelGrid columns="3" style="width:100%">
											<h:panelGroup>
											<h:selectBooleanCheckbox id="streets" value="#{interactiveViewerHelper.selectedZone.availableServices.streets}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.streets']}" for="streets"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="water" value="#{interactiveViewerHelper.selectedZone.availableServices.water}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.water']}" for="water"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="sidewalks" value="#{interactiveViewerHelper.selectedZone.availableServices.sidewalks}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.sidewalks']}" for="sidewalks"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="drainage" value="#{interactiveViewerHelper.selectedZone.availableServices.drainage}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.drainage']}" for="drainage"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="access" value="#{interactiveViewerHelper.selectedZone.availableServices.access}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.access']}" for="access"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="topography" value="#{interactiveViewerHelper.selectedZone.availableServices.topography}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.topography']}" for="topography"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="location" value="#{interactiveViewerHelper.selectedZone.availableServices.location}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.location']}" for="location"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="electricity" value="#{interactiveViewerHelper.selectedZone.availableServices.electricity}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.electricity']}" for="electricity"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="lighting" value="#{interactiveViewerHelper.selectedZone.availableServices.lighting}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.lighting']}" for="lighting"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="phone" value="#{interactiveViewerHelper.selectedZone.availableServices.phone}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.phone']}" for="phone"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="tvcable" value="#{interactiveViewerHelper.selectedZone.availableServices.tvcable}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.tvcable']}" for="tvcable"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="garbage_truck" value="#{interactiveViewerHelper.selectedZone.availableServices.garbageTruck}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.garbage_truck']}" for="garbage_truck"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="heritage" value="#{interactiveViewerHelper.selectedZone.availableServices.heritage}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.heritage']}" for="heritage"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="landscape_value" value="#{interactiveViewerHelper.selectedZone.availableServices.landscapeValue}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.landscape_value']}" for="landscape_value"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="vulnerable" value="#{interactiveViewerHelper.selectedZone.availableServices.vulnerable}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.vulnerable']}" for="vulnerable"/>
											</h:panelGroup>
											
											<h:panelGroup>
											<h:selectBooleanCheckbox id="business_class" value="#{interactiveViewerHelper.selectedZone.availableServices.businessClass}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
											<h:outputLabel value="#{messages['txt.available_services.business_class']}" for="business_class"/>
											</h:panelGroup>
										</h:panelGrid>
									</rich:tab>
									<rich:tab label="#{messages['txt.easement']}">
										<div align="center">
											<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
												<a4j:commandLink
													value="#{messages['txt.easement.addnew']}"
													action="#{interactiveViewerHelper.parcelDataHelper.newEasement}"
													reRender="frmEditEasement"
													oncomplete="#{rich:component('editEasementDlg')}.show()">
												</a4j:commandLink>
												<br />
												<br />
												<br />
											</h:panelGroup>
											<h:panelGroup id="grpEasement">
												<h:panelGroup rendered="#{empty interactiveViewerHelper.selectedZone.easements}">
													<h:outputText value="#{messages['txt.easement.no_easements']}" />
												</h:panelGroup>
												<rich:dataTable value="#{interactiveViewerHelper.selectedZone.easements}" var="easement" rendered="#{not empty interactiveViewerHelper.selectedZone.easements}">
													<rich:column>
														<f:facet name="header">
															<h:outputText value="#{messages['txt.easement.type']}" />
														</f:facet>
														<h:outputText value="#{messages[easement.type.name()]}" />
													</rich:column>
													<rich:column>
														<f:facet name="header">
															<h:outputText value="#{messages['txt.easement.document_type']}" />
														</f:facet>
														<h:outputText value="#{messages[easement.documentType.name()]}" />
													</rich:column>
													<rich:column>
														<f:facet name="header">
															<h:outputText value="#{messages['txt.easement.beneficiary_number']}" />
														</f:facet>
														<h:outputText value="#{easement.beneficiaryNumber}" />
													</rich:column>
													<rich:column>
														<a4j:commandLink
															value="#{messages['txt.details']}"
															action="#{interactiveViewerHelper.parcelDataHelper.viewEasement(easement)}"
															reRender="frmEditEasement"
															oncomplete="#{rich:component('editEasementDlg')}.show();">
														</a4j:commandLink>
													</rich:column>
													<rich:column rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
														<a4j:commandLink
															value="#{messages['txt.edit']}"
															action="#{interactiveViewerHelper.parcelDataHelper.editEasement(easement)}"
															reRender="frmEditEasement"
															oncomplete="#{rich:component('editEasementDlg')}.show();">
														</a4j:commandLink>
													</rich:column>
													<rich:column rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
														<a4j:commandLink value="#{messages['txt.delete']}" />
													</rich:column>
												</rich:dataTable>
											</h:panelGroup>
											
											<ui:remove>
											<rich:dataGrid
												width="100%"
												rendered="#{not empty interactiveViewerHelper.selectedZone.easements}"
												value="#{interactiveViewerHelper.selectedZone.easements}"
												var="easement">
												
												<f:facet name="header">
													<rich:datascroller maxPages="15"></rich:datascroller>
												</f:facet>
												<f:facet name="footer">
													<rich:datascroller maxPages="15"></rich:datascroller>
												</f:facet>
												
												<table style="width: 100%">
													<tr valign="top">
														<td width="80%">
															<h:panelGrid columns="2">
																<h:outputText value="#{messages['txt.easement.type']}" />
																<h:outputText value="#{messages[easement.type.name()]}" />
								
																<h:outputText value="#{messages['txt.easement.document_type']}" />
																<h:outputText value="#{messages[easement.documentType.name()]}" />
								
																<h:outputText value="#{messages['txt.easement.beneficiary_number']}" />
																<h:outputText value="#{easement.beneficiaryNumber}" />
															</h:panelGrid>
														</td>
														<td>
															<h:panelGrid columns="1">
																<a4j:commandLink
																	value="Editar"
																	action="#{interactiveViewerHelper.parcelDataHelper.editEasement(easement)}"
																	reRender="frmEditEasement"
																	oncomplete="#{rich:component('editEasementDlg')}.show();">
																</a4j:commandLink>
															</h:panelGrid>
														</td>
													</tr>
												</table>
											</rich:dataGrid>
											</ui:remove>
										</div>
									</rich:tab>
									<rich:tab label="#{messages['txt.improvement']}">
										<div align="center">
											<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
												<a4j:commandLink
													value="#{messages['txt.improvement.addnew']}"
													action="#{interactiveViewerHelper.parcelDataHelper.newImprovement}"
													reRender="frmEditImprovement"
													oncomplete="#{rich:component('editImprovementDlg')}.show()">
												</a4j:commandLink>
												<br />
												<br />
												<br />
											</h:panelGroup>
											<h:panelGroup id="grpImprovement">
												<h:panelGroup rendered="#{empty interactiveViewerHelper.selectedZone.improvements}">
													<h:outputText value="#{messages['txt.improvement.no_improvements']}" />
												</h:panelGroup>
												<rich:dataTable value="#{interactiveViewerHelper.selectedZone.improvements}" var="improvement" rendered="#{not empty interactiveViewerHelper.selectedZone.improvements}">
													<rich:column>
														<f:facet name="header">#{messages['txt.improvement.use']}</f:facet>
														<h:outputText value="#{improvement.use}" />
													</rich:column>
													<rich:column>
														<f:facet name="header">#{messages['txt.improvement.easement_class']}</f:facet>
														<h:outputText value="#{improvement.easementClass}" />
													</rich:column>
													<rich:column>
														<f:facet name="header">#{messages['txt.improvement.percentage_good']}</f:facet>
														<h:outputText value="#{improvement.percentageGood}" />
													</rich:column>
													<rich:column>
														<f:facet name="header">#{messages['txt.improvement.year_built']}</f:facet>
														<h:outputText value="#{improvement.yearBuilt}" />
													</rich:column>
													<rich:column>
														<a4j:commandLink
															value="#{messages['txt.details']}"
															action="#{interactiveViewerHelper.parcelDataHelper.viewImprovement(improvement)}"
															reRender="frmEditImprovement"
															oncomplete="#{rich:component('editImprovementDlg')}.show();">
														</a4j:commandLink>
													</rich:column>
													<rich:column rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
														<a4j:commandLink
															value="#{messages['txt.edit']}"
															action="#{interactiveViewerHelper.parcelDataHelper.editImprovement(improvement)}"
															reRender="frmEditImprovement"
															oncomplete="#{rich:component('editImprovementDlg')}.show();">
														</a4j:commandLink>
													</rich:column>
													<rich:column rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
														<a4j:commandLink value="#{messages['txt.delete']}" />
													</rich:column>
												</rich:dataTable>
											</h:panelGroup>
											
											<ui:remove>
											<rich:dataGrid
												width="100%"
												rendered="#{not empty interactiveViewerHelper.selectedZone.improvements}"
												value="#{interactiveViewerHelper.selectedZone.improvements}"
												var="improvement">
												
												<table style="width: 100%">
													<tr valign="top">
														<td width="80%">
															<h:panelGrid columns="2">
																<h:outputText value="#{messages['txt.improvement.use']}" />
																<h:outputText value="#{improvement.use}" />
								
																<h:outputText value="#{messages['txt.improvement.easement_class']}" />
																<h:outputText value="#{improvement.easementClass}" />
								
																<h:outputText value="#{messages['txt.improvement.percentage_good']}" />
																<h:outputText value="#{improvement.percentageGood}" />
																
																<h:outputText value="#{messages['txt.improvement.year_built']}" />
																<h:outputText value="#{improvement.yearBuilt}" />
			
																<h:outputText value="#{messages['txt.improvement.number_of_floors']}" />
																<h:outputText value="#{improvement.numberOfFloors}" />
																
																<h:outputText value="#{messages['txt.improvement.front']}" />
																<h:outputText value="#{improvement.front}" />
																
																<h:outputText value="#{messages['txt.improvement.depth']}" />
																<h:outputText value="#{improvement.depth}" />
																
																<h:outputText value="#{messages['txt.improvement.area']}" />
																<h:outputText value="#{improvement.area}" />
																
																<h:outputText value="#{messages['txt.improvement.observation']}" />
																<h:outputText value="#{improvement.observation}" />
															</h:panelGrid>
														</td>
														<td>
															<h:panelGrid columns="1">
																<a4j:commandLink
																	value="Editar"
																	action="#{interactiveViewerHelper.parcelDataHelper.editImprovement(improvement)}"
																	reRender="frmEditImprovement"
																	oncomplete="#{rich:component('editImprovementDlg')}.show();">
																</a4j:commandLink>
															</h:panelGrid>
														</td>
													</tr>
												</table>
											</rich:dataGrid>
											</ui:remove>
										</div>
									</rich:tab>
								</rich:tabPanel>
							</div>
						</rich:tab>
						<rich:tab label="#{messages['dataentry.editdata.registry_section']}" rendered="#{interactiveViewerHelper.selectedZone.property != null}">
							<div class="contentEditData">
								<h:panelGrid id="editDataRegistryTab" columns="2">
									<h:outputLabel value="#{messages['txt.reg_number']}" for="reg_number"/>
									<h:inputText id="reg_number" label="#{messages['txt.reg_number']}" value="#{interactiveViewerHelper.selectedZone.property.registration.code}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
		
									<h:outputLabel value="#{messages['txt.tome']}" for="tome"/>
									<h:inputText id="tome" label="#{messages['txt.tome']}" value="#{interactiveViewerHelper.selectedZone.property.registration.tome}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
								
									<h:outputLabel value="#{messages['txt.folio']}" for="folio" />
									<h:inputText id="folio" label="#{messages['txt.folio']}" value="#{interactiveViewerHelper.selectedZone.property.registration.folio}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
								
									<h:outputLabel value="#{messages['txt.annotation_number']}" for="annotation_number"/>
									<h:inputText id="annotation_number" label="#{messages['txt.annotation_number']}" value="#{interactiveViewerHelper.selectedZone.property.registration.annotationNumber}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
								</h:panelGrid>
							</div>
						</rich:tab>
						<rich:tab label="#{messages['dataentry.editdata.tax_section']}" rendered="#{interactiveViewerHelper.parcelSelected}">
							<div class="contentEditData">
								<h:panelGrid id="editDataTaxTab" columns="2">
									<h:outputLabel value="#{messages['dataentry.editdata.commercial_appraisal']}" for="commercial_appraisal"/>
									<h:inputText id="commercial_appraisal" label="#{messages['dataentry.editdata.commercial_appraisal']}" value="#{interactiveViewerHelper.selectedZone.commercialAppraisal}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
		
									<h:outputLabel value="#{messages['dataentry.editdata.fiscal_appraisal']}" for="fiscal_appraisal"/>
									<h:inputText id="fiscal_appraisal" label="#{messages['dataentry.editdata.fiscal_appraisal']}" value="#{interactiveViewerHelper.selectedZone.fiscalAppraisal}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
		
									<h:outputLabel value="#{messages['dataentry.editdata.payed_taxes']}" for="payed_taxes"/>
									<h:inputText id="payed_taxes" label="#{messages['dataentry.editdata.payed_taxes']}" value="#{interactiveViewerHelper.selectedZone.payedTaxes}" disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}"/>
		
									<h:outputLabel value="#{messages['dataentry.editdata.status']}" />
									<h:selectOneMenu value="#{interactiveViewerHelper.selectedZone.status}"
									converter="#{uiConverters.taxStatusType}"
									disabled="#{not interactiveViewerHelper.parcelDataHelper.editing}">
										<f:selectItems value="#{uiConverters.taxStatusType.valueList}"/>
									</h:selectOneMenu>
								</h:panelGrid>
							</div>
						</rich:tab>
						<rich:tab label="#{messages['dataentry.editdata.landuse_section']}">
							<div class="contentEditData">
								<div align="center">
									<h:panelGroup id="editDataLandUseTab">
										<h:outputLabel value="#{messages['dataentry.editdata.primary_landuse']}" for="namePrimaryLandUse" style="font-weight:bold;"/>
										<rich:separator lineType="solid"/>
										<br />
										<h:panelGroup id="namePrimaryLandUse">
											<table style="width:95%">
												<tr>
													<th style="width:80%;text-align: left;">
														<h:outputText value="#{generalHelper.formatLandUseText( interactiveViewerHelper.selectedZone.landUse )}" />
													</th>
													<td>
														<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
															<a href="#" onclick="selectPrimaryLandUse();">#{messages['button.select']}</a>
														</h:panelGroup>
													</td>
												</tr>
											</table>
										</h:panelGroup>
										
										<br />
										<br />
										<br />
										
										<h:outputLabel value="Otros tipos de uso" style="font-weight:bold;"/>
										<rich:separator lineType="solid"/>
										<br />
										<h:panelGroup id="otherLandUsesGrp">
											<h:panelGroup rendered="#{interactiveViewerHelper.parcelDataHelper.editing}">
												<a href="#" onclick="selectOtherLandUse();">#{messages['button.add']}</a>
												<br />
												<br />
											</h:panelGroup>
											<h:panelGroup id="otherLandUses">
												<h:panelGroup rendered="#{not empty interactiveViewerHelper.selectedZone.otherLandUses}">
													<rich:dataGrid var="landUse" value="#{interactiveViewerHelper.selectedZone.otherLandUses}" columns="2">
														<table style="width: 200px">
															<tr>
																<td style="width: 70%">
																	<h:outputText value="#{selectLandUseHelper.landUseName(landUse)}" />
																</td>
																<td>
																	<a4j:commandLink
																		rendered="#{interactiveViewerHelper.parcelDataHelper.editing}"
																		ajaxSingle="true"
																		value="#{messages['txt.delete']}"
																		action="#{interactiveViewerHelper.deleteLandUseFromSelectedZone(landUse)}"
																		reRender="otherLandUses">
																	</a4j:commandLink>
																</td>
															</tr>
														</table>
													</rich:dataGrid>
												</h:panelGroup>
												<h:outputText rendered="#{empty interactiveViewerHelper.selectedZone.otherLandUses}" value="Ninguno(a) registrado(a)" style="color:Red;" />
											</h:panelGroup>
										</h:panelGroup>
									</h:panelGroup>
								</div>
							</div>
						</rich:tab>
					</rich:tabPanel>
					
					<br />
					
					<div align="center">
						<h:panelGroup id="editSaveBtns">
							<h:panelGroup rendered="#{interactiveViewerHelper.allowEditing}">
								<a4j:commandButton value="#{messages['button.edit']}" immediate="true"
									action="#{interactiveViewerHelper.parcelDataHelper.beginEditData}"
									rendered="#{not interactiveViewerHelper.parcelDataHelper.editing}"
									reRender="#{interactiveViewerHelper.parcelDataHelper.reRenderSaveBtns}">
								</a4j:commandButton>
								
								<a4j:commandButton value="#{messages['button.save']}"
									action="#{interactiveViewerHelper.parcelDataHelper.applyDataChange}"
									rendered="#{interactiveViewerHelper.parcelDataHelper.editing}"
									reRender="#{interactiveViewerHelper.parcelDataHelper.reRenderSaveBtns}"
									oncomplete="if (#{facesContext.maximumSeverity != null}) #{rich:component('msgPanel')}.show();">
								</a4j:commandButton>
								#{'  '}
								<a4j:commandButton value="#{messages['button.cancel']}" immediate="true"
									action="#{interactiveViewerHelper.parcelDataHelper.cancelEditData}"
									rendered="#{interactiveViewerHelper.parcelDataHelper.editing}"
									reRender="#{interactiveViewerHelper.parcelDataHelper.reRenderSaveBtns}">
								</a4j:commandButton>
							</h:panelGroup>
						</h:panelGroup>
					</div>
				</h:form>
					
				<h:form>
					<a4j:jsFunction
						name="selectPrimaryLandUse"
						oncomplete="#{rich:component('editDataView:selectLandUsePanel')}.show()">
						<f:setPropertyActionListener target="#{selectLandUseHelper.returnValueField}" value="interactiveViewerHelper.selectedZone.landUse" />
						<f:setPropertyActionListener target="#{selectLandUseHelper.reRenderComponents}" value="namePrimaryLandUse" />
					</a4j:jsFunction>
					<a4j:jsFunction
						name="selectOtherLandUse"
						oncomplete="#{rich:component('editDataView:selectLandUsePanel')}.show()">
						<f:setPropertyActionListener target="#{selectLandUseHelper.addingToList}" value="#{true}" />
						<f:setPropertyActionListener target="#{selectLandUseHelper.addToListMethod}" value="interactiveViewerHelper.addLandUseToSelectedZone" />
						<f:setPropertyActionListener target="#{selectLandUseHelper.returnValueField}" value="interactiveViewerHelper.selectedZoneLandUse" />
						<f:setPropertyActionListener target="#{selectLandUseHelper.reRenderComponents}" value="otherLandUses" />
					</a4j:jsFunction>
				</h:form>
			</h:panelGroup>
		</h:panelGroup>
	</rich:modalPanel>

	<ui:include src="includes/editEasementDlg.xhtml" />
	<ui:include src="includes/editImprovementDlg.xhtml" />
	<f:subview id="editDataView">
		<ui:include src="/WEB-INF/includes/selectLandUse.xhtml" />
	</f:subview>
</ui:component>

